{{- /* Author */ -}}

{{- $name := .name -}}
{{- $link := "" -}}
{{- $absLink := "" -}}
{{- $linkTag := $name -}}
{{- $email := "" -}}
{{- $avatar := "" -}}
{{- $i18n := dict -}}

{{- if .author -}}
    {{- $i18n = (index .author .lang) -}}
    {{- $name = .author.name -}}
    {{- $link = .author.link -}}
    {{- $absLink = .author.link -}}
    {{- $email = .author.email -}}
    {{- $avatar = .author.avatar -}}
    {{- with .author.gravatarEmail -}}
        {{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%v?s=240&d=mp" -}}
    {{- end -}}
{{- end -}}

{{- if $i18n -}}
    {{- $name = $i18n.name -}}
{{- end -}}

{{- if $link -}}
    {{- $linkTag = printf `<a href="%s" class="archive-item-link" title="%s" target="_blank"> %s </a>` $link $name $name -}}
{{- end -}}

{{- $link :=  (printf "authors/%s" .name) | urlize | relLangURL -}}

{{- return dict "author" .author "email" $email "name" $name "link" $link "absLink" $absLink "avatar" $avatar -}}